<?php

foreach ($tags as $tag) {
    echo '<li><a href="'.url('ticket/detail/'.$tag->id).'">' . $tag->tag . '</a></li>';
}

//print_r($categories);